<?php

namespace app\user\model;

use think\Model;
use think\Request;
use app\common\model\BaseModel;

/**
 * @property int    $feedback_id
 * @property string $content       反馈内容
 * @property string $images        反馈图片
 * @property int    $user_id       反馈用户ID
 * @property string $feedback_type 反馈分类:1=投诉;2=建议
 * @property string $reply_content 回复内容
 * @property string $status        状态: 0=未处理;1=已处理
 * @property string $create_time
 * @property string $update_time
 */
class Feedback extends BaseModel
{
    // 表名
    protected $table = 'zn_feedback';
    protected $pk    = 'feedback_id';
    const primaryKey = 'feedback_id';

    protected $type = [
        'images' => 'json'
    ];
    // 追加属性
    protected $append = [

    ];

    public static function __make(Request $request)
    {
        return (new self())->find($request->param(self::primaryKey));
    }

    public function user()
    {
        return $this->hasOne(User::class, 'user_id', 'user_id');
    }
}
